package com.wyl.netty.controller;

import com.wyl.netty.common.protobuf.UserModule;
import com.wyl.netty.client.Client;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wyl
 * @date: 2021/7/13
 * @des:
 */
@RestController
public class IndexController {

    @GetMapping("/index")
    public String index() {
        return "index";
    }

    @GetMapping("/save")
    public String save() {
        Client.getInstance().sendMessage("user", "save",
                UserModule.User.newBuilder().setUserId("001").setUserName("张三").build());
        return "save";
    }

    @GetMapping("/update")
    public String update() {
        Client.getInstance().sendMessage("user", "update",
                UserModule.User.newBuilder().setUserId("002").setUserName("李四").build());
        return "update";
    }
}
